<%@page import="model.Theme"%>
<%@page import="model.PublicUser"%>
<!DOCTYPE html>
<html>
    <head>
        <title>IEPM</title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <%@include file = "global/include.jsp" %>
        
        <%
            Theme[] themes = (Theme[]) session.getAttribute("themeList");%>
        <script type="text/javascript">
            window.history.forward();
            function noBack(){ window.history.forward(); }
            
            $(document).ready(function(){ 
                $('#err').hide();
            });  
            
            function onClickSubmit(){    
                var valid =true;
            
            <% for (int i = 0; i < themes.length; i++) {%>
                    var a= $('input:radio[name=indQns_<%=((Theme) themes[i]).getId()%>]:checked').val();
                    if(a==null){
                        $("#indQnsTxt<%=((Theme) themes[i]).getId()%>").css("color","red");
                        valid=false;
                    }else{
                        $("#indQnsTxt<%=((Theme) themes[i]).getId()%>").css("color","black");
                    }
            <% }%>
                
                    if(valid==true){
                        $('#form1').submit(); 
                    }else{
                        $('#err').show();
                    }
                }
        </script>
    </head>
    <body onload="noBack();" onpageshow="if (event.persisted) noBack();" onunload="">
        <div id="centerColumn" class="ui-widget ui-widget-content ui-corner-all">
            <%@include file = "global/header.jsp" %>
            <!--//Your Content//-->
            <div style=" position:relative; left:9%;">
                <ul class="steps">
                    <li class="start"><span>1</span>Step 1</li>
                    <li class="next"><span>2</span>Step 2</li>
                    <li class="empty"><span>3</span>Step 3</li>
                </ul>
                <br class="clear" />
            </div>
            <h2 title="Industry Questions" class="reflected">Industry Questions</h2>
            <br/>
            <br/>
            <form id="form1" action="FrontEndServlet?action=proceedToFirmQns" method="post">
                <center>
                    <table id="matrix">
                        <tbody>
                            <tr>
                                <td class="matrixTitle">No.</td>
                                <td class="matrixTitle">Questions</td>
                                <td class="matrixTitle">Strongly<br/>Disagree</td>
                                <td class="matrixTitle">Disagree</td>
                                <td class="matrixTitle">Neutral</td>
                                <td class="matrixTitle">Agree</td>
                                <td class="matrixTitle">Strongly<br/>Agree</td>
                            </tr>
                            <% for (int i = 0; i < themes.length; i++) {%>
                            <tr id="radio<%=i%>">
                                <td><%=(i + 1)%>.</td>
                                <td style="text-align: left;" >
                                    <span id="indQnsTxt<%=((Theme) themes[i]).getId()%>"><%=((Theme) themes[i]).getInd_qns()%></span>
                                </td>
                                <td>
                                    <input type="radio" id="radio<%=i%>1" value="1" name="indQns_<%=((Theme) themes[i]).getId()%>" />
                                </td>
                                <td>
                                    <input type="radio" id="radio<%=i%>2" value="2" name="indQns_<%=((Theme) themes[i]).getId()%>" />
                                </td>
                                <td>
                                    <input type="radio" id="radio<%=i%>3" value="3" name="indQns_<%=((Theme) themes[i]).getId()%>" />
                                </td>
                                <td>
                                    <input type="radio" id="radio<%=i%>4" value="4" name="indQns_<%=((Theme) themes[i]).getId()%>" />
                                </td>
                                <td>
                                    <input type="radio" id="radio<%=i%>5" value="5" name="indQns_<%=((Theme) themes[i]).getId()%>" />
                                </td>
                            </tr>
                            <% }%>
                        </tbody>
                    </table>
                </center>
                <br/><br/>
                <div id="err" class="ui-widget">
                    <div class="ui-state-error ui-corner-all" style="padding: 0 .7em;"> 
                        <p>
                            <span class="ui-icon ui-icon-alert" style="float: left; margin-right: .7em;"></span> 
                            <strong>Error:</strong> Questions not completed!
                        </p>
                    </div>
                    <br/>
                </div>
                <center>
                    <input onclick="onClickSubmit()" type="button" id="inputButton" value="Next" />
                </center>
            </form>
            <%@include file = "global/footer.jsp" %>
        </div>
        <!--//end #centerColumn//-->
    </body>
</html>
